package org.jeecg.modules.c.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.c.entity.MDevice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: 设备管理
 * @Author: jeecg-boot
 * @Date:   2024-11-05
 * @Version: V1.0
 */
public interface MDeviceMapper extends BaseMapper<MDevice> {

    @Select("SELECT\n" +
            "\tSUBSTRING( DeviceID, LENGTH( DeviceID ) - 1, 2 ) AS LastTwoChars \n" +
            "FROM\n" +
            "\tM_Device \n" +
            "WHERE\n" +
            "\tDeviceType = #{deviceType} \n" +
            "ORDER BY\n" +
            "\tASCII(\n" +
            "\tRIGHT ( DeviceID, 1 )) DESC,\n" +
            "\tCAST( RIGHT ( LEFT ( DeviceID, 4 ), 1 ) AS UNSIGNED ) DESC \n" +
            "\tLIMIT 1")
    String getMaxSellno(@Param("deviceType") String deviceType);

}
